using System;

namespace CoreRay
{
	//-------------------------------------------------------------------------------------
	/// <summary>
	/// Abstract class that must be implemented by a log message receivers.
	/// </summary>
	//-------------------------------------------------------------------------------------

	public abstract class LogReceiver : IDisposable
	{
		//-------------------------------------------------------------------------------------
		// Private member.
		//-------------------------------------------------------------------------------------

		private LogInformationTypes informationType;


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Default constructor.
		/// </summary>
		//-------------------------------------------------------------------------------------

		protected LogReceiver() : this(LogInformationTypes.All)
		{

		}


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Releases the resources taked by the object. Implements the IDisposable interface.
		/// </summary>
		//-------------------------------------------------------------------------------------

		public void Dispose()
		{
			this.Dispose(true);
		}


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Disposes the object.
		/// <param name="disposing">True if we are disposing from the dispose method.</param>
		/// </summary>
		//-------------------------------------------------------------------------------------

		protected virtual void Dispose(bool disposing)
		{
			
		}


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor of the abstract class.
		/// </summary>
		/// <param name="informationType">Information type accepted.</param>
		//-------------------------------------------------------------------------------------

		protected LogReceiver(LogInformationTypes informationType)
		{
			this.informationType = informationType;
		}


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the information type that the log receiver accept.
		/// </summary>
		/// <value>Information type accepted by the log receiver.</value>
		//-------------------------------------------------------------------------------------

		public LogInformationTypes InformationType
		{
			get
			{
				return this.informationType;
			}
		}


		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Writes a message to the log.
		/// </summary>
		/// <param name="message">Message to write.</param>
		/// <param name="category">Category of the message.</param>
		/// <param name="messageInformationType">Type of the information.</param>
		//-------------------------------------------------------------------------------------
		
		public abstract void Write(string message, string category, LogInformationTypes messageInformationType);
	}
}
